package com.zjc.app.api.sdk.client;

import com.google.gson.reflect.TypeToken;
import com.zjc.app.api.sdk.dto.ResultDto;

import com.zjc.app.api.sdk.exception.AppBizRuntimeException;

import java.io.IOException;

/**
 * 泵送接口
 */
public class BengSongClient extends BaseClient {

    public BengSongClient(String serverUrl, String appId, String appSecret, Integer connectTimeout, Integer readTimeout) {
        super(serverUrl, appId, appSecret, connectTimeout, readTimeout);
    }

    /**
     *
     * @param request
     * @return
     * @throws IOException
     * @throws AppBizRuntimeException
     */
    public ResultDto<Object> setParams(QueryNewestParamsRequest request) throws IOException, AppBizRuntimeException {
        String url = "/v1/param.set";
        return super.doPost(url, request, new TypeToken<ResultDto<Object>>() {});
    }

    /**
     *
     * @param requests
     * @return
     * @throws IOException
     * @throws AppBizRuntimeException
     */
    public ResultDto<Object> selectNewestParams(QueryNewestParamsRequest requests) throws IOException, AppBizRuntimeException {
        String url = "/v1/param.select";
        return super.doPost(url, requests, new TypeToken<ResultDto<Object>>() {});
    }

    /**
     *
     * @param requests
     * @return
     * @throws IOException
     * @throws AppBizRuntimeException
     */
    public ResultDto<Object> requestSelectParams(QueryNewestParamsRequest requests) throws IOException, AppBizRuntimeException {
        String url = "/v1/param.request";
        return super.doPost(url, requests, new TypeToken<ResultDto<Object>>() {});
    }
}
